package com.atguigu.day16.date;

import org.junit.Test;

import java.util.Calendar;

/*
Date:
    new Date(); 执行一刹那的时间
    new Date(毫秒值): 指定毫秒值的日期对象
    date.getTime(); 日期对象的毫秒值
Calendar:了解

DateFormat:日期格式化类
       Date --> 字符串

       字符串--> Date:

 */
public class CalendarTest {
    @Test
    public void test01(){
        Calendar c = Calendar.getInstance();
        System.out.println("c = " + c);

        int year = c.get(Calendar.YEAR);
        System.out.println("year = " + year);
        int month = c.get(Calendar.MONTH);
        System.out.println("month = " + month);
    }


    @Test
    public void test02(){
     Calendar c = Calendar.getInstance();
        System.out.println("c.get(Calendar.YEAR) = " + c.get(Calendar.YEAR));//2024
        //对日期进行更改
        c.add(Calendar.YEAR,3);

        System.out.println("c.get(Calendar.YEAR) = " + c.get(Calendar.YEAR));


    }
}
